package com.qh.book.utils;

import com.qh.book.VO.ResultVO;
import com.qh.book.dto.BookDTO;
import com.qh.book.enums.ResultEnum;

public class ResultVOUtil {

	public static ResultVO returnError(ResultEnum resultEnum) {
		ResultVO<BookDTO> resultVO = new ResultVO<BookDTO>();
		resultVO.setStatus(resultEnum.getCode());
		resultVO.setMsg(resultEnum.getMsg());
		return resultVO;
	}
	
	public static ResultVO returnError(ResultEnum resultEnum, String msg) {
		ResultVO<BookDTO> resultVO = new ResultVO<BookDTO>();
		resultVO.setStatus(resultEnum.getCode());
		resultVO.setMsg(msg);
		return resultVO;
	}
	
	public static ResultVO<Object> returnSuccess(ResultEnum resultEnum, Object obj) {
		ResultVO<Object> resultVO = new ResultVO();
		resultVO.setStatus(resultEnum.getCode());
		resultVO.setMsg(resultEnum.getMsg());
		resultVO.setData(obj);
		return resultVO;
	}
}
